class Solution(object):

    def __init__(self):
        self.dp = [1, 10]

    def countNumbersWithUniqueDigits(self, n):
        """
        :type n: int
        :rtype: int
        """
        if n < 2:
            return self.dp[n]
        else:
            s = 9
            for i in range(n-1):
                s = s * (9-i)
            return s + self.countNumbersWithUniqueDigits(n-1)
            

s = Solution()
print(s.countNumbersWithUniqueDigits(3))